<%= form_with model: @new_user, url: signup_path do |f| %>
  <p>
  To create a new account, enter your e-mail address and a password.
  Your e-mail address will never be shown to users and will only be used
  if you need to reset your password, or to receive optional new-message
  alerts.  Your username can be changed later.
  </p>

  <%= errors_for(@new_user) %>

  <div class="labelled_grid">
    <% if not Rails.application.open_signups? %>
      <%= f.hidden_field "invitation_code", :value => @invitation.code, :name => :invitation_code %>
      <%= f.label :invitation, "Invited By", :class => "required" %>
      <%= link_to @invitation.user.username, user_path(@invitation.user), target: '_blank' %>
    <% end %>

    <%= f.label :username, "Username", :class => "required" %>
    <div>
      <%= f.text_field :username %>
      <div class="hint">
        <tt><%= User.username_regex_s %></tt>
      </div>
    </div>

    <%= f.label :email, "E-mail Address", :class => "required" %>
    <div>
      <%= f.email_field :email %>
      <div class="hint">
        <a href="http://www.gravatar.com/" target="_blank">Gravatar</a>'ized
      </div>
    </div>

    <%= f.label :password, "Password", :class => "required" %>
    <%= f.password_field :password, :autocomplete => "off" %>

    <%= f.label :password_confirmation, "Password (again)",
      :class => "required" %>
    <%= f.password_field :password_confirmation, :autocomplete => "off" %>

    <p>
    Want to tell us about yourself?  It's optional, but it will be visible in
    your public profile and can be changed at any time.
    </p>

    <%= f.label :about, "About", :class => "required" %>
    <div>
      <%= f.text_area :about%>

      <%= render :partial => "global/markdownhelp" %>
    </div>
  </div>

  <%= f.submit "Signup" %>
<% end %>
